package test1;

import java.util.Scanner;

public class Calc {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入第一个数");
        int  num1=sc.nextInt();
        System.out.println("请输入第二个数");
        int  num2=sc.nextInt();
        System.out.println("请输入运算符");
        String s=sc.next();
        Calc c=new Calc();
        if (s.equals("+")){
            c.sum(num1,num2);
        }else if (s.equals("-")){
            c.Reducing(num1,num2);
        }
        else if (s.equals("*")){
            c.By(num1,num2);
        }
        else if (s.equals("/")){
            c.Except(num1,num2);
        }
    }
    public void sum(int num1,int num2){
        System.out.println("两个数相加的值为"+(num1+num2));
    }
    public void Reducing(int num1,int num2){
        System.out.println("两个数相减的值为"+(num1-num2));
    }
    public void By(int num1,int num2){
        System.out.println("两个数相乘的值为"+(num1*num2));
    }
    public void Except(int num1,int num2){
        if(num2!=0) {
            System.out.println("两个数相除的值为" + (num1 / num2));

        }else {
            System.out.println("除数不能为0");
        }
    }
}
